<?php
/**
 * Widget for displaying content of three categories (triple widget) on home page
 *
 * Used for both single and index/archive/search.
 *
 * @package WordPress
 * @subpackage lebanontimes
 * @since Lebanon Times 1.0
 */

include dirname(__FILE__)."/categoryMapping.php";
?>

<div class="horizontalWidget widgetMargin">
    <div style="background-color: #FFF; width: 100%; height: 45px; clear: both;">
        <div class="tabActive">
            <span style='float: right'>
                <a href="<?php echo get_category_link( $categoryMapping['culture'][0] );?>">
                    <?php echo get_the_category_by_ID( $categoryMapping['culture'][0] );?>
                </a>
            </span>
        </div>
    </div>
    <div class="content">
        <?php $posts = get_posts("category={$categoryMapping['culture'][0]}&numberposts=0");
            add_filter( 'the_title', 'max_title_length');
            for($i=0; $i<$categoryMapping['culture'][1] && $i < count($posts); $i++) {
                                $post = $posts[$i]; ?>
                <a href="<?php the_permalink() ?>" target="_parent">
                    <div style="height: 80px; overflow-y: hidden;"><?php the_post_thumbnail( array(135,135) ); ?></div>
                    <?php the_title(); ?>
                </a>
        <?php 
            } 
            remove_filter( 'the_title', 'max_title_length');
        ?>
    </div>
</div>